package com.chenlong.pc.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.chenlong.pc.dao.DebtDao;
import com.chenlong.pc.dao.LogDao;
import com.chenlong.pc.entity.Debt;
import com.chenlong.pc.service.BaseService;

@Service
public class DebtService implements BaseService<Debt> {

	private DebtDao debtDao;
	
	private LogDao logDao;
	
	@Autowired
	public void setDebtDao(DebtDao debtDao) {
		this.debtDao = debtDao;
	}
	
	@Autowired
	public void setLogDao(LogDao logDao) {
		this.logDao = logDao;
	}

	@Override
	public List<Debt> findAll(Map<String, Object> params) {
		return debtDao.findAll(params);
	}

	@Override
	public Debt findById(Map<String, Object> params) {
		return debtDao.findById(params);
	}

	@Override
	public List<Debt> findTop(Map<String, Object> params) {
		return debtDao.findTop(params);
	}

	@Override
	public int countAll(Map<String, Object> params) {
		return debtDao.countAll(params);
	}

	@Override
	public void delete(Map<String, Object> params, Map<String, Object> logParam) {
		debtDao.delete(params);
		logDao.save(logParam);
	}

	@Override
	public void save(Map<String, Object> params, Map<String, Object> logParam) {
		debtDao.save(params);
		logDao.save(logParam);
	}

	@Override
	public void update(Map<String, Object> params, Map<String, Object> logParam) {
		debtDao.update(params);
		logDao.save(logParam);
	}
	
}
